// async function bufferSplit(buffer,str){
//     let startLocation = 0;
//     let endLocation = 0;

//     let allSubscript = async (e)=>{
//         // 获取e的所有下表
//         startLocation = 0;
//         endLocation = 0;    
//         Buffer.from("").
//         while((endLocation = buffer.indexOf(e,startLocation)) != -1){
//             location.push(endLocation);
//             startLocation = endLocation+1;
//         }
//     }
    
//     let location = [0];
//     // 获取所有符合条件的下标
//     await Promise.allSettled(str.map(e=>{
//         return allSubscript(e)
//     }));

//     return

//     location = location.sort((a,b)=>a-b);
//     let bufferarr = [];
//     // 对location进行排序
//     for(let e=0;e<=location.length;e+=2){
//         bufferarr.push(buffer.slice(location[e],location[e]+1));
//     }
//     return bufferarr.push(buffer.slice(location[location.length-1])),location;
// }


// let buff = Buffer.from("aa:b?b:cc");

// main()
// async function main(){
//     console.time("time")
//     await bufferSplit(buff,[":","?"])
//     console.timeEnd("time")
//     buff = buff.toString("hex");
    
    
//     console.time("time")
//     buff.split(/:|\?/g).map(e=>Buffer.from(e,"hex"));
//     console.timeEnd("time")
// }

let http = require("http");

http.createServer((req,res)=>{
    let data = "";
    req.on("data",a=>data+=a)
    req.on("end",_=>{
        console.log(req.url);
        console.log(req.method)
        console.log(data)
        console.log();
    })

    
    res.end("yes");
}).listen(80,"0.0.0.0")